<?php if (!defined("_ECRIRE_INC_VERSION")) return; if (class_exists('PdkArticleModel')) return;
/**
 * SPIP Plugin Development Kit
 *
 * @author     Aleksey Yaroshchuk (aleksey.yaroshchuk@gmail.com)
 * @license    GNU/GPL
 * @package    plugins
 * @subpackage pdk
 * @category   outils
 * @copyright  (c) Aleksey Yaroshchuk 2011-2012
 * @link       http://www.spip-contrib.net/Developmet-Kit
 * @version    1.0.0
 */

include_spip('classes/pdk_model');
/** 
 *  This is PDK SPIP Article model
 *
 *  @author Aleksey Yaroshchuk (aleksey.yaroshchuk@gmail.com)
 */
class PdkArticleModel extends pdk_Model {
    public function __construct() {
        parent::__construct();
        $this->config_model();        
    }
    
    function config_model() {
        // Define main table:
        $this->main_table = 'spip_articles';
        
        // Define primary key:
        $this->primary_key = 'id_article';
        
        // Define main table fields:
        $this->main_fields['id_article'] = 'id_article';
        $this->main_fields['titre'] = 'titre';  
        $this->main_fields['id_rubrique'] = 'id_rubrique';
                                               
         // Define validation rules:
         $this->validation->set_rules( 
            array(
               array(
                     'field'   => 'id_rubrique',
                     'label'   => 'ID rubrique',
                     'rules'   => ''
                  )
            )
         );                                     
    }
    
    // Define test data for model
    public $test_data = array(
        array('id_article'=>1,'titre'=>'Test article 1','id_rubrique'=>'1'),
        array('id_article'=>2,'titre'=>'Test article 2','id_rubrique'=>'2'),
        array('id_article'=>3,'titre'=>'Test article 3','id_rubrique'=>'3'),
        array('id_article'=>4,'titre'=>'Test article 4','id_rubrique'=>'4')
    );
}
?>